<?php
exists_frame();
abstract class libdata extends data_class{
    public $obj_array = array();
    public function class_redirect($class,$method='',$params='') {
        class_redirect($class,$method,$params,$this->cfg->uri_mode);
    }
    public function __get($name) {
        $value = $this->get_data_property($name);
        if($value !== null) return $value;
        if(strlen($name) == 1 && ord($name)>=41 && ord($name)<=90) {
            if(array_key_exists($name,$this->obj_array)) {
                return $this->obj_array[$name];
            }
            $this->obj_array[$name] = new data_class;
            return $this->obj_array[$name];
        }
        if (array_key_exists($name, $this->user_data)) {
            return $this->user_data[$name];
        } else {
            return null;
        }
    }    
    public function __call($name,$arg) {
        if(array_key_exists($name,$this->obj_array)) {
            return $this->obj_array[$name];
        }
        return $obj_array[$name] = $this->load_data_operate_class($name,$arg);
    }
    public function get_data_property($name) {
        return null;
    }
    public function load_data_operate_class($name, $arg) {
        throw new debug('need define load_data_opreate_class to call '. $name);
    }
}
